<!DOCTYPE html>
<html>

<head lang="en">
    <title>找攻略</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/myStrategyComment.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/plugins/form/jquery.form.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(function () {
            /**
             * lituan
             */
            var param= getParams();
            console.log(param.strategyId);
            $("#submitBtn").click(function () {
                //保存评论
                if (param.strategyId) {
                    var strategyUserComment={};
                    strategyUserComment.content= $(".comment textarea[name='content']").val();

                    $.post('/strategyComments/'+param.strategyId+'/strategyUserComment',strategyUserComment,function (data) {
                        if (data.success) {
                            $(document).dialog({
                                autoClose: 1000,
                                content: '保存成功',
                            });
                            location.href="/mine/strategyComment.html?id="+param.strategyId;
                        }else {
                            $(document).dialog({
                                overlayClose: true,
                                content: '保存失败,稍后再试',
                            });
                        }
                    })
                }
                //保存回复
               // jQuery.ajaxSettings.traditional = true;
                if (param.replyUserId && param.strategyUserCommentId) {
                    $("[name='replyUser.id']").val(param.replyUserId);
                    $("#commentForm").attr("action","/strategyUserComments/"+param.strategyUserCommentId+"/strategyReplyUserComments")
                     $("#commentForm").ajaxSubmit(function (data) {
                         if (data.success) {
                             $(document).dialog({
                                 autoClose: 1000,
                                 content: '保存成功',
                             });
                             location.href="/mine/strategyComment.html?id="+sessionStorage.getItem("strategyCommentId")
                         }else {
                             $(document).dialog({
                                 overlayClose: true,
                                 content: '保存失败,稍后再试',
                             });
                         }
                     })
                }
            })

        })
    </script>
</head>

<body>

<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:window.history.go(-1)">
                <span><i class="fa fa-chevron-left" ></i></span>
            </a>

        </div>
        <div class="col">
            <span>点评</span>
        </div>

        <div class="col"></div>
    </div>
</div>

<div class="comment">
    <form id="commentForm" method="post" >
        <input type="hidden" name="replyUser.id">
        <textarea name="content" class="form-control" rows="5" placeholder="请输入你的评论/回复.."></textarea>
    </form>
</div>

<div class="operation">
    <button class="btn" onclick="window.history.go(-1)">放弃评价</button>
    <button class="btn" id="submitBtn">提交评价</button>
</div>





</body>


</html>